<?php
class Core_Controller_BaseController extends Zend_Controller_Action
{
	public function init()
	{
		$authNamespace = new Zend_Session_Namespace('Zend_Auth');
		if ( isset( $authNamespace->user ) && $authNamespace->user !== null ) {
			$this->view->authOK = $authNamespace->user;
			
			$user = Application_Model_User::getInstance( $authNamespace->user );
			$factory = new Core_Common_AclFactory();
			$acl = $factory->createAcl( $this, $user );
			
			if( $acl->hasRole( $user->getId() ) && $acl->isAllowed($user->getId(), $this->getId() ) ) {
			  $this->view->aclStatus = 'PERMITED!';
			} else {
				$this->view->aclStatus = 'DENIED!';
			}
 		}
	}
	
	public function getId() {
	 return $this->_getParam('controller').'_'.$this->_getParam('action'); 
	}
	
}